<template>
	<view>
		<form @submit="onSubmit" @reset="">
			<view class="evaluate"><textarea placeholder-style="color: #9a9a9a" placeholder="请输入评价" v-model="content" /></view>
			<view class="rate"><uni-rate v-model="rank" size="16" ></uni-rate></view>
			<view class="form-button"><button type="primary" @click="evaluateAddSubmit">提交评价</button></view>
		</form>
	</view>
</template>

<script>
import config from '../../config.js'

import uniRate from '@/components/uni-rate/uni-rate.vue';

export default {
	components: { uniRate },

	data() {
		return {
			rank: 5,
			content: '',
			order_goods_id : 0
		};
	},
	onLoad(options) {

		this.order_goods_id = options.order_goods_id

	},
	methods: {
		evaluateAddSubmit() {

		  this.$http.post('/shop.order/evaluate_create', {
				order_goods_id: this.order_goods_id,
				content: this.content,
				rank: this.rank
			}).then(res => {

		    if (res.data.data) {

				uni.showToast({
					icon:'none',
					title:'谢谢您的评价'
				})
				
				this.$EventBus.$emit('evaluate_add_success', 'ok');

				uni.navigateBack()
		    }


		  });


		}
	},
};
</script>

<style lang="scss">
	.evaluate{
		width: 100%;
		    padding: 40rpx;
		    background-color: #fff;
		    border-bottom: 1px solid #e4e3e6;
		    box-sizing: border-box;
	}
.rate {
	background-color: #ffffff;
	height: 50rpx;
	padding-top: 50rpx;
	padding-left: 20rpx;
}
</style>
